@extends('admin.layout.index')
@section('content')
<div class="col-md-12">
  <!-- Advanced Tables -->
  <div class="card">
    <div class="card-action">Advanced Tables</div>
    <div class="card-content">
      <div class="table-responsive">
        <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline" role="grid">
			<div class="row">
				<div class="col-sm-6">
					
				</div>
			</div>

          <div class="row">
            <div class="col-sm-6">
              <div class="dataTables_length" id="dataTables-example_length">
              	<form action="/admin/order/index" method="get">
                <label>
                  <select name="count" aria-controls="dataTables-example" class="form-control input-sm">
                    @for($i = 10 ; $i <= 30 ; $i+=10)
                    <option value="{{ $i }}" @if(!empty($request['count']) && $request['count'] == $i) selected @endif>{{ $i }}</option>
                    @endfor
                </select>records per page</label>
              </div>
            </div>
            <div class="col-sm-2">
            </div>
            <div class="col-sm-4">
              <label>
                  <select name="year" aria-controls="dataTables-example" class="form-control input-sm">
                    <option value=>请选择</option>
                    @for($i = date('Y',time()) ; $i > 2000 ;$i--)
                    <option value="{{ $i }}" @if(!empty($request['year']) && $request['year'] == $i) selected @endif>{{ $i }}</option>
                    @endfor
                </select>年</label>
                  　
                <label>
                  <select name="month" aria-controls="dataTables-example" class="form-control input-sm">
                    <option value=>请选择</option>
                    @for($ii = 1 ; $ii < 13 ;$ii++)
                    <option value="{{ $ii }}" @if(!empty($request['month']) && $request['month'] == $ii ) selected @endif>{{ $ii }}</option>
                    @endfor
                </select>月</label>

                <button type="submit" class="btn btn-default"> 查询 </button>
            </div>
          </form>
          </div>

          <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
            <thead>
              <tr role="row">
                <th class="sorting_asc" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column ascending" style="width: 190px;">订单状态(共<span id="my_count">{{ $res['count'] }}</span>/条)</th>
                <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 158px;">创建时间</th>
                <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending" style="width: 180px;">订单金额(￥<span id="my_sum">{{ $res['sum'] }}</span>)</th>
                <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 200px;">处理时间</th>
                <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 200px;">收获地址</th>
                <th class="sorting" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 234px;">操作</th></tr>
            </thead>
            <tbody>
            	@foreach($data as $v)
              <tr class="gradeA odd" @if($v['merstatus'] == 2)style="background:#F2DEDE"@elseif($v['merstatus'] == 1)style="background:#D9EDF7"@elseif($v['merstatus'] == 3)style="background:#FCF8E3"@elseif($v['merstatus'] == 4)style="background:#F2DEDE"@endif>
                <td class="sorting_1">@if($v['merstatus'] == 2)商家未处理@elseif($v['merstatus'] == 1)买家未处理@elseif($v['merstatus'] == 0)交易完成@elseif($v['merstatus'] == 3)订单异常处理中@elseif($v['merstatus'] == 4)订单异常未处理@endif</td>
                <td class=" ">{{ date('y-m-d h:i:s' , $v['ctime']) }}</td>
                <td class=" ">￥{{ $v['price'] }}</td>
                <td class="center ">{{date('d',$v['errctime']-$v['ctime'])}}天</td>
                <td class="center">{{ $v['site'] }}</td>
                <td class="center ">
                	<a href="javascript:;" card="{{ $v['id'] }}" price="{{ $v['price'] }}" onclick="mydel(this)">删除</a>
                	|
                	<a href="/admin/order/detail?id={{ $v['id'] }}">详情</a>
                </td>
            </tr>
            	@endforeach
            </tbody>
          </table>
          <div class="row">
            <div class="col-sm-6">
              <div class="dataTables_info" id="dataTables-example_info" role="alert" aria-live="polite" aria-relevant="all">Showing 1 to 10 of 57 entries</div></div>
            <div class="col-sm-6">
              <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
                {!! $data -> appends($request) -> render() !!}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!--End Advanced Tables --></div>
@endsection
@section('classified')
  <script src="/adminassets/orderIndexJs/orderindex.js"></script>
@endsection